<?php namespace Home\Controller; 
use Think\Controller;

class CommonController extends Controller
{
	public function _initialize()
	{
		$paths= MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME;
		$pathss= MODULE_NAME.'/'.CONTROLLER_NAME;

		if (in_array($paths,C('AUTH_PATHS'))) {
		 	if (!isset($_SESSION['id'])) {
		 		$this->error('请先登录',U('home/login/index'));
		 	}
		 }
		 if (in_array($pathss,C('AUTH_PATHS'))) {
		 		if (!isset($_SESSION['id'])) {
		 		$this->error('请先登录',U('home/login/index'));
		 	}
		 }
	}

	public function autonum($table,$filed,$num,$id)
	{
		$sql="update ".$table." set ".$filed . "=". $filed. $num." where id='{$id}'" ;

		M()->execute($sql);

	}




}



?>